# -*- coding: utf-8 -*-
# Author: jurrabi <jurrabi@gmail.com>
# URL: http://code.google.com/p/mytvalacarta//
#
# This file is part of myTValacarta.
#
# myTValacarta is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# myTValacarta is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with myTValacarta.  If not, see <http://www.gnu.org/licenses/>.
'''
Created on 22/08/2010
@author: jurrabi
xbmc General Description 
'''

import os

from tools import logger
logger.debug("[xbmc]Init")

def translatePath(xbmc_path):
    if xbmc_path.lower().startswith('special://'):
        #Special Paths
        #TODO: Add all special paths
        if xbmc_path.lower().startswith('special://profile/addon_data/'):
            scriptID_and_rest = xbmc_path[29:].split('/',1)
            if len(scriptID_and_rest)>1:
                rest = scriptID_and_rest[1]
            else:
                rest = ''
            path = os.path.join(os.getcwd(),rest)
        else:
            path = os.path.join(os.getcwd(),xbmc_path[10:])
    else:
        path = xbmc_path
    return path